import Index from "../views/Index.vue";
import User from "../views/User.vue";
import Product from "../views/Product.vue";
import Cart from "../views/Cart.vue";
import { createRouter, createWebHashHistory } from "vue-router";

const router = createRouter({
    history:createWebHashHistory(),
    routes:[
        {path:'/',redirect:'/index',meta:{title:'首页',name:"index"}},
        {path:'/index',component:Index, meta:{title:'首页',}},
        {path:'/user',component:User, meta:{title:'用户中心',}},
        {path:'/product', component:Product,meta:{title:'商品',}},
        {path:'/cart', component:Cart, meta:{title:'购物车',}},
    ]
})
router.beforeEach((to,from,next)=>{
    document.title=to.meta.title;
    next();
})
export default router